﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class news : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            binddata();
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Write("<script type=\"text/javascript\">window.open('newslist.aspx','_self');</script>");
    }
      protected void binddata()
    {
        string str = "SELECT top 1 subject,sender,content ,message_time FROM  messagebox order by message_time desc;";
        DataSet ds = new DataSet();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(str, con);
        SqlCommand cmd = new SqlCommand(str, con);
        cmd.ExecuteNonQuery();
        sda.Fill(ds);
        Label16.Text = ds.Tables[0].Rows[0][0].ToString();
        Label13.Text = ds.Tables[0].Rows[0][1].ToString();
        Label12.Text = ds.Tables[0].Rows[0][2].ToString();
        Label15.Text = ds.Tables[0].Rows[0][3].ToString();
    }
}
